/**
 * Copyright 2021 nicos AG
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @author Simon Petrac <spetrac@nicos-ag.com>
 * @contributor Jörg Langkau <jlangkau@nicos-ag.com>
 * @license Apache-2.0
 */

const
    config          = require('./config.js'),
    util            = require('./util.js'),
    md_renderer     = require('./renderer.md.js'),
    tcs_md_renderer = require('./renderer.tcs-md.js'),
    tds_md_renderer = require('./renderer.tds-md.js');

util.asyncIIFE(async function main() {

    const
        ttlDataFiles = await util.expandFoldersToFiles(config.ttlDataFiles, /\.ttl$/),
        data         = await util.loadDataFromTurtleFiles(ttlDataFiles),
        graph        = await util.generateGraphFromData(data), // this takes quite some time, so be patient
        renderParam  = {
            version: config.current_version,
            data:    data,
            graph:   graph
        },
        renderConfig = {
            language: 'en'
        },
        renderFn     = md_renderer['FIR_DYNAMIC_TABLE_questionnaire_v2'],
        renderResult = renderFn(renderParam, renderConfig);

    console.log(renderResult);

}); // main
